<template>
  <div class="result_wrapper">
    <div class="coupon_list">
      <div style="margin-bottom:1rem;" v-for="(item, index) in coupons" :key="index">
        <ballot-coupon :coupon="item" :result="true" :ranking="item.num"></ballot-coupon>
      </div>
      <div class="lastInfoMore white_color" v-if="this.coupons.length > 3">没有更多</div>
    </div>
  </div>
</template>

<script>
import {queryAllRankCoupon} from 'src/service/getData3.js'
import BallotCoupon from './coupon.vue'

export default {
  name: 'ballot-result-coupon',
  components: {BallotCoupon},
  data: () => ({
    coupons: []
  }),
  async created() {
    try {
      let res = await queryAllRankCoupon(this.$route.query.id)
      if (res.respCode === '00') {
        let data = res.content.couponList
        this.coupons = data
      } else {
        throw new Error(res.errorInfo)
      }
    } catch (e) {
      Toast({
        message: e.message,
        duration: 1000
      });
    }
  }
}
</script>

<style lang="css" scoped>
.result_wrapper {
  min-height:100%;
  width:100%;
  margin-top:-48px;
  background: linear-gradient(to right top, #4d32a4, #844ae2);
}
.coupon_list {
    width: 90%;
    margin: auto;
    padding-top: 60px;
}
</style>
